perm filename FDDERI.TIM[TIM,LSP]5 blob sn#763201 filedate 1984-07-31 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00006 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 SAIL
C00004 00003	āˆ‚16-Jul-82  0012	Mabry Tyson <Tyson at SRI-AI> 	DERIV, DDERIV, FDDERIV results    
C00009 00004	LM-2
C00010 00005	 NIL
C00012 00006	 PSL Numbers 7/31/84
C00013 ENDMK
CāŠ—;
; SAIL
(fasload fdderiv)
(timit)
Timing performed on Friday 07/16/82 at 10:14:31.
Cpu Time = 2.533
Elapsed Time = 188.9
Wholine Time = 53.2
GC Time = 21.323
Load Average Before  = 0.651587844
Load Average After   = 2.27102423
Average Load Average = 1.46130604
NIL 
Timing performed on Friday 07/16/82 at 10:17:51.
Cpu Time = 2.531
Elapsed Time = 95.516666
Wholine Time = 47.3333335
GC Time = 19.569
Load Average Before  = 2.1588266
Load Average After   = 2.29448807
Average Load Average = 2.22665733
NIL 
Timing performed on Friday 07/16/82 at 10:20:18.
Cpu Time = 2.5
Elapsed Time = 239.716667
Wholine Time = 41.5
GC Time = 19.381
Load Average Before  = 2.20678627
Load Average After   = 3.79014647
Average Load Average = 2.99846637
NIL 
;;; New SAIL
(fasload fdderiv)
(timit)
Timing performed on Wednesday 10/12/83 at 22:30:50.
Cpu (- GC) Time = 2.148
Elapsed Time = 109.633333
Wholine Time = 34.616667
GC Time = 18.277
Load Average Before  = 0.87691331
Load Average After   = 2.03311336
Average Load Average = 1.45501333
NIL 
āˆ‚16-Jul-82  0012	Mabry Tyson <Tyson at SRI-AI> 	DERIV, DDERIV, FDDERIV results    
Date: 16 Jul 1982 0003-PDT
From: Mabry Tyson <Tyson at SRI-AI>
Subject: DERIV, DDERIV, FDDERIV results
To: rpg at SU-AI

Results for DERIV, DDERIV, FDDERIV for UCILISP (UT's version).

All timings are on SRI-AI's 2060 with load average around 0.2.

Notes on coding of the programs:
UCILISP open codes MAPCAR if the function is specified by a
LAMBDA expression but does not if the function is a defined function.
Therefore, (MAPCAR 'FOO BAR) was translated into (MAPCAR (FUNCTION
(LAMBDA (X) (FOO X))) BAR) to keep in the spirit of the open coded
version sent out.

DDERIV and FDDERIV involve calling a function which is the value of
a local variable.  In UCILISP this may be done by simply calling
(FOO ...) where FOO is the local variable rather than fooling with
FUNCALL or SUBRCALL.  This format handles both cases.  With (NOUUO
NIL), these function calls do not become direct jumps (because the
value may change next time).

There was a slight problem in having the compiler produce SUBR code
to be stored under a different property (DERIV).  It could be done
but not conveniently.  So I just compiled the code as SUBR's and
editted the LAP code to make it load onto the DERIV property.

DDERIV and FDDERIV were the version that had the (CONS 'TIMES A) in
the definition for TIMES.

The loop was a PROG which had 5 calls to DERIV and looped 1000 times.
The function that did this was compiled to minimize the overhead.
In order to compute the overhead, I had a similar loop that called
a dummy function that just returned its arguments.  Its cost was
about 0.21 seconds for the (NOUUO T) case and about 0.04 seconds
for the (NOUUO NIL) case.  I did NOT subtract these out in the following
results (but I feel they should be).

Each test run produced about 265000 conses and I had about 150000 free words.
I did a GC before each run to keep things as constant as possible.

Function	(NOUUO T)		(NOUUO NIL)

DERIV		14.879-0.875 (.213)	4.451-0.868 (.043)
DDERIV		16.250-0.856 (.198)	4.983-0.855 (.044)
FDDERIV		16.073-0.873 (.211)	4.857-0.871 (.028)
DDERIV*		18.171-1.742 (.212)	6.091-1.717 (.043)

The format of the times are
		total-gc (dummy)
where total is the total CPU time (including GC), GC is the amount used for
garbage collection and dummy is the amount of time used by the dummy loop.  I
believe the clock ticks about every 0.015 seconds which explains the
difference between the .028 and .044 dummy times (one less tick).

Explanation of results:
I believe the second and third to be slower because the property list of
the variable (whose value was the property name) had to be searched twice,
first for a function property and then for the value of the variable.
Then, for the DDERIV case, another property list had to be searched to
find the function definition.

The DDERIV* case is one in which a FUNCALL is used.  In UCILISP this
results in an extra CONS and a call to APPLY* which then does everything
done above.  As you can see, it is slower.
-------

;;;LM-2
;; 9. FDERIV

;; FDDERIV 3 shouldn't be any different on the LM-2 than DDERIV, if I understand
;; it correctly.


;; 8. DDERIV

(DEFUN TEST-DDERIV ()
  (TIMING "DDERIV" (RUN)))

;; Compiled:  25.4 seconds.


;;; NIL
FDDERIV

Fixnum arithmetic.
We don't support that format of defun.  However, we have a sort
of subrcall, in that i can bind a lexical function to a
compiled-function, and the call to it will be "direct", the same as if
it had been an ordinary function call.  That is, assuming that the
DERIV property of something is a compiled function, i can change
(DEFUN DERIV (A)
   (COND ((ATOM A) (COND ((EQ A 'X) 1) (T 0)))
	 (T (LET ((DERIV (GET (CAR A) 'DERIV)))
	      (COND (DERIV (SUBRCALL T DERIV (CDR A)))
		    (T 'ERROR))))))
to be
(DEFUN DERIV (A)
   (COND ((ATOM A) (COND ((EQ A 'X) 1) (T 0)))
	 (T (LET ((DERIV (GET (CAR A) 'DERIV)))
	      (COND (DERIV ((lambda ((&function f)) (f (cdr a))) deriv))
		    (T 'ERROR))))))
This is sort of the primitive function-cell binding from which FLET
is built.

cpu=33.22,elapsed=34.93,pagefaults=4721
cpu=33.03,elapsed=34.33,pagefaults=4677

Inline carcdr:
cpu=26.52,elapsed=28.41,pagefaults=4748
cpu=26.45,elapsed=28.29,pagefaults=4721
;;; PSL Numbers 7/31/84

          |KL-10b|  20-60 | 20-60 | 3600 | 20-60 | CRAY | 12Mhz| HP-UX
Benchmark |MACLSP|InterLsp|PSL 3.2| ZetaL|PSL 3.3|PSL3.2| HP200|PSL3.3
--------------------------------------------------------------------------
Fdderiv   |  2.15|    -   |   -   |   -  |   -   |   -  |   -  |